package my.study.java.util.concurrent.Executors;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import my.study.java.util.concurrent.Callable.CallableExample01;

public class FixedThreadPoolEx01 {

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		System.out.println("main submit start");
		ExecutorService executorService = Executors.newFixedThreadPool(1);
		executorService.submit(new CallableExample01(1, 1000L));
		executorService.submit(new CallableExample01(2, 1000L));
		executorService.submit(new CallableExample01(3, 1000L));
		System.out.println("main submit over");
		executorService.shutdown();
		System.out.println("executorService.shutdown()");
		while (!executorService.isTerminated()) {
			Thread.sleep(1000);
			System.out.println("Thread sleep");
		}
		System.out.println("main over)");
		
	}

}
